<template>
  <view class="privacy-settings">
    <!-- 返回按钮和页面标题 -->
    <view class="header">
      <tn-button 
        backgroundColor="tn-bg-left" 
        style="color: black; position: absolute; left: 5%; top: 10%; width: 35px; height: 35px; font-size: 25px;" 
        :border="false"
        @click="handleReturn"
      >
        <text class="tn-icon-left"></text>
      </tn-button>
      <view class="title">隐私</view>
    </view>

    <!-- 设置项列表 -->
    <view class="setting-list">
      <view class="setting-item">
        <view class="setting-name">允许查看我的关注/粉丝列表</view>
        <switch v-model="isFollowListVisible" class="setting-switch"></switch>
      </view>

      <view class="setting-item">
        <view class="setting-name">允许查看我动态的范围</view>
        <switch v-model="isDynamicVisible" class="setting-switch"></switch>
      </view>

      <view class="setting-item">
        <view class="setting-name">系统权限管理</view>
        <view class="setting-action" @click="handleSystemPermission">管理APP使用的系统权限</view>
      </view>

      <view class="setting-item">
        <view class="setting-name">推荐管理</view>
        <view class="setting-action" @click="handleRecommendation">管理个性化推荐内容的显示</view>
      </view>

      <view class="setting-item">
        <view class="setting-name">未成年保护</view>
        <view class="setting-action" @click="handleMinorProtection">查看未成年保护政策</view>
      </view>

      <view class="setting-item">
        <view class="setting-name">隐私政策摘要</view>
        <view class="setting-action" @click="handlePrivacyPolicy">查看《隐私权政策》</view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      // 设置项开关的状态
      isFollowListVisible: false,
      isDynamicVisible: false,
    };
  },
  methods: {
    // 返回上一页
    handleReturn() {
      uni.navigateBack({ delta: 1 });
    },
    // 跳转到系统权限管理页面
    handleSystemPermission() {
      uni.navigateTo({
        url: '/pages/permission-management'
      });
    },
    // 跳转到推荐管理页面
    handleRecommendation() {
      uni.navigateTo({
        url: '/pages/recommendation-management'
      });
    },
    // 跳转到未成年保护页面
    handleMinorProtection() {
      uni.navigateTo({
        url: '/pages/minor-protection'
      });
    },
    // 跳转到隐私政策页面
    handlePrivacyPolicy() {
      uni.navigateTo({
        url: '/pages/privacy-policy'
      });
    }
  }
};
</script>

<style scoped>
.privacy-settings {
  padding: 20px;
  background-color: #f8f8f8;
  height: 100%;
}

.header {
  position: relative;
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 10%; /* 增加顶部内边距，确保标题不会被返回按钮遮挡 */
}

.title {
  font-size: 30px;
  font-weight: bold;
  position: relative; /* 修改为相对定位 */
  left: 0; /* 重置左偏移 */
  transform: none; /* 重置变换效果 */
  margin-top: 20px; /* 增加顶部外边距，确保标题不会被返回按钮遮挡 */
  color: #333;
  letter-spacing: 1px;
  font-family: "宋体", SimSun, sans-serif; /* 修改字体为宋体 */
}

.setting-list {
  margin-top: 30px;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid #e1e1e1;
}

.setting-name {
  font-size: 18px;
  color: #333;
  font-family: "宋体", SimSun, sans-serif; /* 修改字体为宋体 */
}

.setting-switch {
  margin-right: 20px;
}

.setting-action {
  font-size: 16px;
  color: #01BEFF;
  cursor: pointer;
  font-family: "宋体", SimSun, sans-serif; /* 修改字体为宋体 */
}
</style>